package com.bbva.kyfb.kyfbjpatlbh.dominiotlbh;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.entity.RooIdentifier;

@Configurable
@Embeddable
@RooIdentifier(dbManaged = true)
public final class TtlsbontPK implements java.io.Serializable, org.springframework.beans.factory.aspectj.ConfigurableObject {

	private static final long serialVersionUID = 1L;

	@Column(name = "COD_LOGONAPL", nullable = false,columnDefinition = "CHAR", length = 20)
    private String codLogonapl;

	@Column(name = "COD_USUARIO", nullable = false,columnDefinition = "CHAR", length = 8)
    private String codUsuario;

	@Column(name = "COD_CLASEORD", nullable = false,columnDefinition = "CHAR", length = 3)
    private String codClaseord;

	public TtlsbontPK(String codLogonapl, String codUsuario, String codClaseord) {
        super();
        this.codLogonapl = codLogonapl;
        this.codUsuario = codUsuario;
        this.codClaseord = codClaseord;
    }

	@SuppressWarnings("unused")
	private TtlsbontPK() {
        super();
    }

	public String getCodLogonapl() {
        return this.codLogonapl;
    }

	public String getCodUsuario() {
        return this.codUsuario;
    }

	public String getCodClaseord() {
        return this.codClaseord;
    }

	public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof TtlsbontPK)) return false;
        TtlsbontPK other = (TtlsbontPK) obj;
        if (codLogonapl == null) {
            if (other.codLogonapl != null) return false;
        } else if (!codLogonapl.equals(other.codLogonapl)) return false;
        if (codUsuario == null) {
            if (other.codUsuario != null) return false;
        } else if (!codUsuario.equals(other.codUsuario)) return false;
        if (codClaseord == null) {
            if (other.codClaseord != null) return false;
        } else if (!codClaseord.equals(other.codClaseord)) return false;
        return true;
    }

	public int hashCode() {
        final int prime = 31;
        int result = 17;
        result = prime * result + (codLogonapl == null ? 0 : codLogonapl.hashCode());
        result = prime * result + (codUsuario == null ? 0 : codUsuario.hashCode());
        result = prime * result + (codClaseord == null ? 0 : codClaseord.hashCode());
        return result;
    }

	public String toJson() {
        return new JSONSerializer().exclude("*.class").serialize(this);
    }

	public static TtlsbontPK fromJsonToTtlsbontPK(String json) {
        return new JSONDeserializer<TtlsbontPK>().use(null, TtlsbontPK.class).deserialize(json);
    }

	public static String toJsonArray(Collection<TtlsbontPK> collection) {
        return new JSONSerializer().exclude("*.class").serialize(collection);
    }

	public static Collection<TtlsbontPK> fromJsonArrayToTtlsbontPKs(String json) {
        return new JSONDeserializer<List<TtlsbontPK>>().use(null, ArrayList.class).use("values", TtlsbontPK.class).deserialize(json);
    }
}
